public class DiffRunnable{

    public static void main(String[] args){

        System.out.println("---- runnable method ----");
        MyRunnable mr1 = new MyRunnable();

        Thread t1 = new Thread(mr1);
        Thread t2 = new Thread(mr1);

        t1.start();
        t2.start();

    }

}

class MyRunnable implements Runnable{

    private int count = 5;

    public void run(){
        while(count > 0){
            System.out.println(Thread.currentThread().getName() + " count = " + count--);
        }
    }

}